# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Maintainer: Jelle van der Waa <jelle@archlinux.org

_pkgname=sqlalchemy-continuum
pkgname=python-sqlalchemy-continuum
pkgver=1.3.14
pkgrel=2
pkgdesc='Versioning and auditing extension for SQLAlchemy'
url='https://github.com/kvesteri/sqlalchemy-continuum'
arch=('any')
license=('BSD')
depends=('python' 'python-sqlalchemy' 'python-sqlalchemy-utils')
makedepends=('python-setuptools' 'python-sphinx')
checkdepends=('sqlite' 'python-pytest' 'python-flexmock' 'python-psycopg2' 'python-mysql-connector'
              'python-six' 'python-anyjson' 'python-flask' 'python-flask-login' 'python-flask-sqlalchemy'
              'python-sqlalchemy-i18n')
optdepends=('python-flask: flask plugin'
            'python-flask-login: flask plugin'
            'python-flask-sqlalchemy: flask plugin'
            'python-sqlalchemy-i18n: internationalization')
options=('!makeflags')
source=(https://github.com/kvesteri/sqlalchemy-continuum/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha512sums=('a48be0902516b95edeac28dd189f74e4831e6e9203099d86d5cbfe9c18914f57a98697501c58e631b99f85158d793feaf8dd69d212dad99a6fd429f8b4475a98')
b2sums=('32c293190c4b823c7206e38ed39bf55d9b005bfe5c1e17eaeec3e609bfde15aa29af45350c3ee5a8a2522ef28d6c7c8070a02380740deaa27dd728e24eabc270')

build() {
  cd ${_pkgname}-${pkgver}
  python setup.py build
  make -C docs text man
}

check() {
  cd ${_pkgname}-${pkgver}/tests
  DB=sqlite pytest -k 'not test_flask' || true
}

package() {
  cd ${_pkgname}-${pkgver}
  python setup.py install --root="${pkgdir}" --optimize=1 --skip-build
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
  install -Dm 644 README.rst docs/_build/text/* -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 docs/_build/man/sqlalchemy-continuum.1 -t "${pkgdir}/usr/share/man/man1"
  ln -sf /usr/share/man/man1/sqlalchemy-continuum.1.gz "${pkgdir}/usr/share/man/man1/${pkgname}.1.gz"
}

# vim: ts=2 sw=2 et:
